//
//  DownloadCell.swift
//  XFDownload
//
//  Created by mac on 2018/10/29.
//  Copyright © 2018 zeroLu. All rights reserved.
//

import UIKit

class DownloadCell: UITableViewCell {

    @IBOutlet weak var nameLabel: UILabel!
    
    @IBOutlet weak var progressLabel: UILabel!
    
    @IBOutlet weak var progressView: UIProgressView!
    
    private(set) var _url: URL?
    
    init() {
        super.init(style: UITableViewCell.CellStyle.default, reuseIdentifier: nil)
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    func setupData(name: String?, url: URL?) {
        
        nameLabel.text = name
        
        _url = url
        
        progressLabel.text = "等待中"
        
        progressView.progress = 0
        
    }
    
    func updateProgress(progressText: String, progress: Float) {
        
        progressLabel.text = progressText
        
        progressView.progress = progress
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
